<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Axios配置</title>
	</head>
	<body>
		
		<h1>远程Ajax测试</h1>
		<script src="../js/axios.js"></script>
		<script>
			
			//1.定义请求拦截器
			axios.interceptors.request.use(function(config){
				//console.log(config)
				//在请求发出前进行信息设置
				config.headers.mytoken = 'qwerqwerqwer'
				return config
			},function(error){
				//报错信息返回
				console.log(error)
			})
			
			
			//2.定义响应拦截器
			axios.interceptors.response.use(function(response){
				console.log(response)
				return response
			},function(error){
				console.log(error)
			})
			
			axios.get("http://localhost:8080/getJSON")
					 .then(function(result){
						 //console.log(result.data)
			})
			
		</script>
	</body>
</html>
